﻿using System;

using System.Text;
using IAM.Interface.Model.Interface;
using System.Web;

namespace IAM.Interface.Model
{
    /// <summary>
    /// 返回操作结果
    /// </summary>
    [Serializable]
    public class Result : AbstractConvertObject,IConvertXml
    {
        #region 属性
        private string _errorcode = "";
        private string _errormessage = "";
        /// <summary>
        /// 返回错误代码
        /// </summary>
        public string ErrorCode
        {
            set
            {
                _errorcode = value;
            }
            get
            {
                return _errorcode;
            }
        }
        /// <summary>
        /// 返回错误消息
        /// </summary>
        public string ErrorMessage
        {
            set
            {
                _errormessage = value;
            }
            get
            {
                return _errormessage;
            }
        }
        #endregion
        #region IConvertXml

        public string XMLBoday
        {
            get
            {
                StringBuilder _xml = new StringBuilder();
                _xml.Append("<Result");
                _xml.Append(" ErrorCode=\"" + IAM.Interface.Common.EnDeCoding.Encode(this.ErrorCode) + "\"");
                _xml.Append(" ErrorMessage=\"" + IAM.Interface.Common.EnDeCoding.Encode(this.ErrorMessage )+ "\"");
                _xml.Append("  />");
                return _xml.ToString();
            }


        }
        public string XMLFinis
        {
            get
            {
                return "";
            }
        }
        public string XML
        {
            get
            {
                return XMLBoday + XMLFinis;
            }
        }
        #endregion
        #region AbstractConvertObject
        public override object ConvertToObject()
        {
            //1.获取当前结点
            this.ErrorCode = IAM.Interface.Common.EnDeCoding.Decode(this.CurrentXmlNode.Attributes["ErrorCode"].InnerText);
            this.ErrorMessage = IAM.Interface.Common.EnDeCoding.Decode(this.CurrentXmlNode.Attributes["ErrorMessage"].InnerText);
            return this;
        }
        #endregion
    }
}
